﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace _1stVATCWed
{
    public partial class TinTuc : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Repeater1_Load(object sender, EventArgs e)
        {
            string connectionString = @"Data Source=TIEN-VAIO\SQLEXPRESS;Initial Catalog=project;Integrated Security=True";
            SqlConnection conn = new SqlConnection(connectionString);
            string Sql = "select top 5 * from TINTUC order by ngaydangtin desc";
            SqlCommand cmd = new SqlCommand(Sql, conn);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            conn.Open();

            DataSet ds = new DataSet();
            adapter.Fill(ds, "Table TINTUC");
            DataTable dt = ds.Tables["Table TINTUC"];

            Repeater1.DataSource = ds.Tables["Table TINTUC"].DefaultView;
            Repeater1.DataBind();
           
        }
    }
}